package jsu.xxy.coffee3.mapper;

import jsu.xxy.coffee3.domain.Ids;
import jsu.xxy.coffee3.domain.ProductMaterial;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import jsu.xxy.coffee3.domain.TableProductMaterial;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
* @author 张从轩
* @description 针对表【product_material】的数据库操作Mapper
* @createDate 2023-06-07 21:10:18
* @Entity jsu.xxy.coffee3.domain.ProductMaterial
*/
@Mapper
public interface ProductMaterialMapper extends BaseMapper<ProductMaterial> {
    @Select("select count(*) from product_material where mid = #{mid} and productid = #{productid}")
    public int getByMidAndProductId(int mid, int productid);

    @Insert("INSERT into product_material (productid , mid , comnum) values (#{productid},#{mid},#{mnum})")
    void add(int mid, int productid, Integer mnum);
    @Delete("delete  from product_material where productid = #{id} ")
    public int deleteById(int id);
    @Delete("DELETE  from product_material where productid = #{productid}")
    public int deleteByMidAndProductid(int productid);
    @Select("select * from product_material where productid = #{productid}")
    public  List<TableProductMaterial> getByProductId(Integer productid);
}




